﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FCS;

namespace Applications.Test
{
    /// <summary>
    /// Summary description for ListRelatedTests
    /// </summary>
    [TestClass]
    public class ListRelatedTests : Functional
    {
        public ListRelatedTests()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [TestMethod]
        public void QuickSortTest()
        {
            Assert.IsTrue(Equals(ListFromArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), new QuickSort(ListFromArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))));
            Assert.IsTrue(Equals(ListFromArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), new QuickSort(ListFromArray(10, 9, 8, 7, 6, 5, 4, 3, 2, 1))));

            Assert.IsTrue(Equals(Empty<int>(), new QuickSort(Empty<int>())));

            Assert.IsTrue(Equals(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10), new QuickSort(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10))));

            Assert.IsTrue(Equals(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10), new QuickSort(ListFromArray(10, 9, 7, 7, 6, 4, 4, 2, 2, 1))));

            Assert.IsTrue(Equals(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10), new QuickSort(ListFromArray(7, 9, 2, 10, 6, 4, 7, 2, 4, 1))));
            Assert.IsTrue(Equals(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10), new QuickSort(ListFromArray(7, 9, 4, 1, 6, 4, 7, 2, 2, 10))));
            Assert.IsTrue(Equals(ListFromArray(1, 2, 2, 4, 4, 6, 7, 7, 9, 10), new QuickSort(ListFromArray(7, 9, 4, 1, 6, 2, 7, 4, 2, 10))));
        }

        [TestMethod]
        public void IsContainTest()
        {
            Assert.IsFalse(new IsContain<int>(1, Empty<int>()).Value);
            Assert.IsTrue(new IsContain<int>(1, ListFromArray(1, 2, 3)).Value);
            Assert.IsFalse(new IsContain<int>(4, ListFromArray(1, 2, 3)).Value);
        }
    }
}
